const { ccclass, property } = cc._decorator


@ccclass
export default class Chess extends cc.Component {
    @property([cc.SpriteFrame])
    private frames: cc.SpriteFrame[] = []

    private _chessName: string
    public get chessName(): string { return this._chessName }


    public init(chessName: string) {
        this._chessName = chessName

        this.node.getComponent(cc.Sprite).spriteFrame = this.frames.find(item => item.name == chessName)

        this.redHide()
    }

    public redShow() {
        this.node.children[0].active = true
    }

    public redHide() {
        this.node.children[0].active = false
    }
}
